package sample;

public enum Enum{

    A("a",1),
    B("b",2);

    // 这两个分别对应常量a，b
    public String a;
    public int b;

    // 构造方法，给成员变量a和b赋值，例如我调用Enum.A 那么就会把常量A的对应数据分别赋值给成员变量a和b，a="a" , b = 1
    Enum(String a, int b) {
        this.a = a;
        this.b = b;

    }

    public String getA() {
        return a;
    }

    public void setA(String a) {
        this.a = a;
    }

    public int getB() {
        return b;
    }

    public void setB(int b) {
        this.b = b;
    }

    @Override
    public String toString() {
        return "Enum{" +
                "a='" + a + '\'' +
                ", b=" + b +
                '}';
    }
}
